﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace GraphicsFramework.Drawing
{
    public abstract class Base : Object
    {
        protected List<Entity.Point2F> points;
        protected List<Entity.Point2F> original;
        private Entity.Point2F center;

        protected List<int> selectednodes;

        private Enum.EnumDrawingType type;
        private Enum.EnumMouseClicks clicks;

        private string description;

        private bool showoutline;
        private bool showfill;
        private bool visible;
        private bool locked;
        private bool selected;
        private bool isvalid;
        private bool isconstructionline;

        //Properties
        protected Property.DrawProperty properties;
        protected Property.TextProperty textproperties;

        public Base(Enum.EnumDrawingType type, string description, Enum.EnumMouseClicks click)
        {
            //Default values
            this.showoutline = true;
            this.showfill = true;
            this.visible = true;
            this.IsConstructionLine = false;
            this.selectednodes = new List<int>();

            this.properties = new Property.DrawProperty();
            this.textproperties = new Property.TextProperty();

            //Assigned values
            this.clicks = click;
            this.description = description;
            this.type = type;

            //List of points
            this.points = new List<Entity.Point2F>();
            this.original = new List<Entity.Point2F>();
            this.center = new Entity.Point2F();
        }

        public virtual Entity.Rectangle2F GetBounds()
        {
            return null;
        }

        public bool Selected
        {
            get { return selected; }
            set
            {
                selected = value;
                if (!selected)
                    selectednodes.Clear();
            }
        }

        public bool Locked
        {
            get { return locked; }
            set { locked = value; }
        }

        public bool ShowOutline
        {
            get { return showoutline; }
            set { showoutline = value; }
        }

        public bool ShowFill
        {
            get { return showfill; }
            set { showfill = value; }
        }

        public bool Visible
        {
            get { return visible; }
            set { visible = value; }
        }

        public Entity.Point2F Center
        {
            get { return center; }
            set { center = value; }
        }

        public Property.DrawProperty Properties
        {
            get { return properties; }
            set { properties = value; }
        }

        public Property.TextProperty TextProperties
        {
            get { return textproperties; }
            set { textproperties = value; }
        }

        public Enum.EnumMouseClicks MouseClick
        {
            get { return clicks; }
        }

        public string Description
        {
            get { return description; }
        }

        protected Enum.EnumDrawingType Type
        {
            get { return type; }
        }

        public bool IsValid
        {
            get { return isvalid; }
            set { isvalid = value; }
        }

        public List<int> SelectedNodes
        {
            get { return selectednodes; }
            set { selectednodes = value; }
        }

        public bool IsConstructionLine
        {
            get { return isconstructionline; }
            set { isconstructionline = value; }
        }

    }
}
